package com.atguigu.ssyx.acl.service.impl;

import com.atguigu.ssyx.acl.mapper.RolePermissionMapper;
import com.atguigu.ssyx.acl.service.RolePermissionService;
import com.atguigu.ssyx.model.acl.RolePermission;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author suchengchen
 * @date 2023/9/9
 * @description
 */
@Service
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper, RolePermission> implements RolePermissionService {
    @Override
    public List<RolePermission> getByRoleId(Long roleId) {

        LambdaQueryWrapper<RolePermission> wrapper = new LambdaQueryWrapper<>();

        wrapper.eq(RolePermission::getRoleId, roleId);

        return baseMapper.selectList(wrapper);
    }

    @Override
    public void removeByRoleId(Long roleId) {

        LambdaQueryWrapper<RolePermission> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(RolePermission::getRoleId, roleId);
        baseMapper.delete(wrapper);

    }

}
